
class PlayerData {

    /** 现金 */
    public static GOLD = 1;
    /** 名声 */
    public static CUP = 2;
    /** 宝石 */
    public static GEM = 3;
    /** 礼盒 */
    public static BOX = 4;
    /** 卡片数量 */
    public static CARD = 8;
    /** 单个名声加成 */
    public static CUP_RATE = 10;
    /** 累计现金数量 */
    public static TOTAL_GOLD = 15;
    /** 收获现金次数 */
    public static GOLD_TIMES = 17;
    /** 爱心*/
    public static LOVE = 18;



    /** 用户头像*/
    public icon: string = "";
    public playerID: number;
    public code: string = "";
    /** 账号 */
    public userName: string = "";

    public playerName: string = "";

    public site: string;

    //现金数量
    public curGold: number = 0;
    //现金单位
    public curGoldUnit: number = 0;
    //名声数量
    public cupNum: number = 0;
    //体力
    public tl: number = 0;
    //名声单位
    public cupNumUnit: number = 0;
    //礼盒数量
    public boxNum: number = 0;
    //宝石数量
    public gemNum: number = 0;
    //现金当前商城ID
    public goldShopID: number = 0;
    //名声当前商城ID
    public cupShopID: number = 0;
    //宝石当前商城ID
    public gemShopID: number = 0;
    //广告礼盒倒计时剩余时间 
    public boxAdTime: number = 0;
    //单个名声加成
    public cupAddRate: number = 0;

    public totalGold: number = 0;

    public totalGoldUnit: number = 0;
    //永久加成
    public yjGoldAdd: number = 0;
    //重置剩余时间 秒
    public nextResetTime: number = 0;
    //浇水倒计时
    public waterAddTime: number = 0;
    //解锁次数
    public unlockTimes: number = 0;
    //领奖天数
    public loginDay: number = 0;
    //上次领奖时间
    public receiveLoingTime: number = 0;
    //邀请奖励ID
    public inviteReward: string;
    //邀请人数
    public inviteNum: number = 0;
    //离线获得现金
    public exitGold: number = 0;
    public exitGoldUnit: number = 0;
    //分享礼盒时间
    public boxShareTime: number = 0;
    //邀请玩家列表
    public invitePlayerList: any[] = [];

    public diamondTimes: number = 0;
    //好友互助倍数
    public helpMulti: number = 1;
    //添加快捷登录
    public shortcutReward: number = 0;

    public boxAdNum: number = 0;
    public shareBoxNum: number = 0;
    //金幣次數
    public goldTimes: number = 0;
    //农田升级次数
    public fieldLvTimes: number = 0;
    //邀请好友通知信息
    public inviteHelpNotify: string = null;
    //爱心
    public love: number;
    //今日剩余打理次数
    public daliNum: number;





    public getGold(): number {
        return this.curGold * Math.pow(10, this.curGoldUnit);
    }

    public getCup(): number {
        return this.cupNum * Math.pow(10, this.cupNumUnit);
    }

    public synPlayerProperty(data: any): void {
        switch (data.type) {
            case PlayerData.GOLD:
                this.curGold = data.value;
                this.curGoldUnit = data.unitID;
                break;
            case PlayerData.CUP:
                this.cupNum = data.value;
                this.cupNumUnit = data.unitID;
                break;
            case PlayerData.GEM:
                this.gemNum = data.value;
                break;
            case PlayerData.BOX:
                this.boxNum = data.value;
                break;
            case PlayerData.CUP_RATE:
                this.cupAddRate = data.value;
                break;
            case PlayerData.TOTAL_GOLD:
                this.totalGold = data.value;
                this.totalGoldUnit = data.unitID;
                break;
            case PlayerData.GOLD_TIMES:
                this.goldTimes = data.value;
                break;
            case PlayerData.LOVE:
                this.love = data.value;
                break;
        }
    }

}
